package com.simple.web.controller.business;

import com.github.zuihou.base.R;
import com.simple.business.domain.dto.user.BabySaveDTO;
import com.simple.business.domain.vo.BabyVO;
import com.simple.business.service.user.BabyService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @desc
 * @Author Simple
 * @Date 2025/3/13 14:18
 **/
@Slf4j
@RequestMapping("/baby")
@RestController
public class BabyController {

    @Resource
    private BabyService babyService;

    @ApiOperation(value = "查看孩子")
    @GetMapping("/queryBabies")
    public R<List<BabyVO>> queryBabies () {
        return babyService.queryBabies();
    }

    @ApiOperation(value = "添加或修改孩子信息")
    @PostMapping("/saveOrUpdateBaby")
    public R<Boolean> saveOrUpdateBaby (@RequestBody BabySaveDTO dto) {
        return babyService.saveOrUpdateBaby(dto);
    }

    @ApiOperation(value = "删除孩子")
    @PostMapping("/batchDeleteBabies")
    public R<Boolean> batchDeleteBabies (@RequestBody List<Long> batchDeleteIds) {
        return babyService.batchDeleteBabies(batchDeleteIds);
    }

}
